<?php

     if (eregi("Vanban.php",$_SERVER['PHP_SELF'])) {
     Header("Location: ../index.php");
     exit;
     }
     $checkurl = $_SERVER['REQUEST_URI'];
     if (preg_match("/http:\/\//i", $checkurl)) {
     Header("Location: ../index.php");
     exit;
     }
     if (!isset($min)) $min=0;
     if (!isset($max)) $max=$min+$offset;

     $sql = "select pid, title, hometext, bodytext from $prefix"._vanban." where (title like '%$query%' OR hometext like '%$query%' OR bodytext like '%$query%') AND active = '1' LIMIT $min,$offset";
     $result = $db->sql_query($sql);
     $nrows  = $db->sql_numrows($result);
     $x=0;
     if ($nrows>0) {
     	echo "<br><font class=storytitle>"._NSRESULTS.":&nbsp;<a href=modules.php?name=Vanban class=storytitle>$m_title</a></font><br><br>";
     while ($row = $db->sql_fetchrow($result)) {
     $pid = $row[pid];
     $title = $row[title];
     $hometext = $row[hometext];
     $bodytext = $row[bodytext];
     $text = "$hometext $bodytext";
     $text = stripslashes(check_html($text, nohtml));
     $text = substr($text, 0, 150);
     $furl = "modules.php?name=Vanban&go=vanban&amp;pid=$pid";
     
     echo "<a href=\"$furl\"><b>$title</b></a></font><br><i>$text ...</i><br><br>";
     $x++;
     }
     } else {
     echo "<br><font class=storytitle>"._NSRESULTS.":&nbsp;<a href=modules.php?name=Vanban class=storytitle>$m_title</a></font><br><br>";
	echo ""._KQNODATA.": <b>''$query''</b> "._KQINMOD." <a href=modules.php?name=Vanban>$m_title</a>";
     }

?>